home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Science / D3Func Demo ƒ / 3DF Doc < prev    next >
Encoding:
Text File  |  1994-11-06  |  8.0 KB  |  377 lines  |  [ttro/ttxt]

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. Introduction
  34.  
  35. Functions of two variables are difficult to reproduce on paper because they exist in 3-D space. 3-D Functions  supplies the user with different functions to choose from, to add or multiply or divide up to 10 function combinations into a special function.  Also supplied is a bunch of preset functions and one nested function. 
  36. Version 2 adds the option of contour plots and constraint functions that can be used in optimization problems, where the user has to identify the region where the function is at an minimum value, etc...
  37. Version 2.2 added the feature of producing a quicktime movie of a rotating surface.  The current plot position is rotated 360 degrees about the z-axis in one degree increments.
  38.  
  39. Functions
  40.  
  41. The application supports three types of functions:
  42.  
  43. (1)  Preset Functions:
  44.   
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.                                                     Figure 1. Preset functions
  58.  
  59. These functions are supported for a quick plot to visualize these surfaces.
  60.  
  61. (2) Nested Function:
  62. This is a step up from the preset functions.  The user will be supplied with a dialog box to select the desired function:
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.                                                 Figure 2. Nested function dialog.
  83.  
  84. The radio buttons will select the two functions, and the coefficients are entered in the text fields.  This type of function is still limited as far as selection goes.
  85.  
  86. (3) Flexible Function:
  87. This type of function can compromise of up to ten combinations, added and/or multiplied.  The user will be prompted to assemble the function:
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.                                                Figure 3. Assembling a function
  110.  
  111. If more functions are desired, select the Add/Multiply... buttons to append another term to the function.  Note that the polynomial function is the same as the argument returned.  Also note that Log( ) and Log10( ) functions return negative infinity if its argument is zero or negative.
  112.  
  113. (4) Constraint Function(s):
  114. The user will be prompted to enter the number of constraint equations (up to 9 functions) of the form f(x, y) = 0. The user can enter the required equation in a dialog box similar to the one in Figure 3 above.  The only difference is that the constraint function is one part only, i.e. no addition or multiplication with other terms.
  115.  
  116. At any time, the z-value at any point can be calculated by entering the x and y values in a dialog box from menu "Function", item  "Solve for a Z Value...", shown in Figure 4. If the "Mark on Graph" box was checked, a patch will be placed on the plot at the corresponding coordinates as in Figure 5. 
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                               
  128.                                             Figure 4. Calculating a Z Value
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.                                             Figure 5. Marking a point on the plot.
  147.  
  148. The application allows some flexibility in the way it represents a function.  Some of the main editable items are presented in a dialog box from menu "Functions" item "Attributes..." shown in Figure 6.  Mesh size, color or gray scale, and limiting z-values are some of the major features.  The resulting plot will look similar to Figure 7 (with 20 mesh points (20 x 20 patches).  The higher that number is, the finer the mesh, and the memory consumption.  If a screen bigger than 13" is used, more RAM might be needed if the free memory falls below 200K.
  149.   
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.                                             Figure 6. Setting plot attributes.
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.                         Figure 7.  Sample screen with 20 mesh points and color.
  187.  
  188. The user can specify the desired range of the x and y axis.  The dialog box of Figure 8 will come up automatically for new functions.  It can also be accessed from the "Functions" menu item "Set X-Y Range...".
  189.   
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                                       Figure 8. Specifying desired axis range.
  202.  
  203. 3-D Aspects
  204.  
  205. In a 3-D environment, the user must specify four angles:
  206. View, roll, pitch, and yaw angles to visualize a certain region of the plot.
  207.  
  208. The view angle has four settings that can be selected from a dialog box in menu "Functions" item "Set View Angle..." shown in Figure 9.
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.                                               Figure 9. Setting View Angle.
  222.  
  223. The yaw angle is fixed for the sake of clarity. The rotations get very confusing when rotating all three axis at the same time. By doing so, the rotations are isolated to rotations about the z-axis (360 degrees in x-y plane) so the user can look  at the plot from all directions.  The last angle, pitch angle, allows the user to look straight at the plot all the way to a top view.  Note that the top view in the color mode can simulate a shaded contour plot showing regions sharing the same z-values, demonstrated in Figure 10.
  224.   
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.                            Figure 10. Top view of Figure 7 doubles as a contour plot
  239.  
  240. The rotations are done interactively by pressing the mouse button in the plot window and drag the mouse, with the button still down, left and right or up and down or any combination to arrive at the desired view.
  241.  
  242. If, for any reason, the plot is too small or not centered, this could be remedied from the "Zoom" menu.  Note that the "Zoom Rectangle.." item allows the user to specify a region to fill the window with.  Also note that due to round off errors some distortion might appear at the edges of the window.
  243.  
  244. Also the screen background color could toggle between black and white.
  245.  
  246. Optimization of a Function
  247.  
  248. Sometimes it is desirable to find the regions of a function that shares a certain value, or an optimum value.  Take as an example a function of the form :
  249.  f= sin(x) * cos(y), pictured in Figures 7 and 10. Let's assume that we need to find the regions where the function value is equal to 0.6. The contour plot has the options of drawing multiple function values ("Drawing Mode") like in Figure 11, or just the function desired value (the optimum point) entered in the dialog box of Figure 12.  When the application is in the "Mouse Mode", when the user selects a point in the Countour Plot Window, the application finds the x and y values an the corresponding function value, then it procedes to find the regions that share the same function value.
  250.  
  251.     
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                         Figures 11. Contour Plots in Drawing and Mouse Modes
  266.  
  267.   
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.                                 Figure 12. Setting up contours attributes
  284.  
  285. Let's assume that we are interested in finding an optimum (minimum) value of the function subjected to certain constraints. After entering the constraints, the application will draw them and the user can then identify the region that would satisfy the constraints and identify the desired optimum point. Note that to find the minimum of a function, just enter "0" in the field in Figure 12, labeled "Desired Function Value:". Figure 13 demonstrates this concept:
  286. Problem statement: Minimize f(x, y) = sin(x)* cos(y) = 0.6, subject to the following constraints:
  287. C1: x - y2=0
  288. C2: x ≥ 0
  289. C3: y≤ 1.2
  290. C4: y≥ 0
  291.  
  292. the contour plot (in Mouse Mode) will reflect these constraints in thick lines and will narrow down the desired region where the optimum value(s) exist (if ever).
  293.  
  294.   
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                           Figure 13. Identifying the optimum region
  312.  
  313. Input / Output
  314.  
  315. The plot, or a part of it, can be copied to the clipboard by selecting menu item "Copy..." from "Functions" menu.  The user will be prompted to select a region to copy.
  316. The plot window could also be printed or exported as a PICT file to be used by other drawing/painting applications.  A movie could also be created to visualize the surface from all directions by rotating it 360 degrees.  Use the menu item  in the file menu.
  317. Another method to save a plot is to save all the parameters into an input file, which is very small.  The user could at any time choose to load that function with all of its attributes and parameters.  All of this is done from the "File" menu.
  318.  
  319. See the menu section for a brief summary of the menus and their functionality.
  320.  
  321. Menus
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.